<?php

use yii\db\Migration;
use yii\db\Schema;
/**
 * Class m181114_053714_CREATE_DB
 */
class m181114_053714_CREATE_DB extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        
         // 服务经理
        $this->createTable('product_serve', [
            "id" =>             Schema::TYPE_PK,
            
            "product_id" =>     Schema::TYPE_INTEGER.   "(10) NOT NULL DEFAULT '0' COMMENT '团队ID'",

            "begin_date" =>      Schema::TYPE_DATE. " NOT NULL COMMENT '开始日期' ",

            "end_date" =>      Schema::TYPE_DATE. " NOT NULL COMMENT '结束日期' ",

            "city" =>        Schema::TYPE_STRING. "(255) NULL COMMENT '目的地城市'",

            "member_id" =>   Schema::TYPE_STRING. "(255) NULL COMMENT '指定导游(多个)'",

            "status" =>         Schema::TYPE_INTEGER.   "(1) DEFAULT  '1' COMMENT '1正常  2 禁用 '",

            "user_id" =>        Schema::TYPE_INTEGER.   "(10) DEFAULT '0' COMMENT '创建人ID'",

            "created_at" =>     Schema::TYPE_DATETIME. " NULL COMMENT '创建时间'",
            "updated_at" =>     Schema::TYPE_TIMESTAMP. " NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
        ], $tableOptions);

    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        echo "m181114_053714_CREATE_DB cannot be reverted.\n";

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m181114_053714_CREATE_DB cannot be reverted.\n";

        return false;
    }
    */
}
